import {getProject} from '@/api/project'
import type { project } from '@/type/project';
import {defineStore} from 'pinia'
import { ref } from 'vue'
export const useProjectStore = defineStore('project', () => {
    const loadingRef = ref(false);
    const dataRef = ref<project | null>(null);
    const fetchData = async () => {
        if (dataRef.value?.length) return;
        loadingRef.value = true;
        const resp = await getProject();
        console.log(resp)
        dataRef.value = resp;
        loadingRef.value = false;
    }
    
    return {
        dataRef, loadingRef, fetchData
    } 
})
